<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/page-tags" prefix="p" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="sf" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>资源列表</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<jsp:include page="../common.jsp"/>
  </head>
  <body>
  <sf:form action="sys/res/list" modelAttribute="resource">
    <div class="box2" panelTitle="查询" id="searchPanel">
		<table>
			<tr>
				<td>资源类型:</td>
				<td>
					<sf:select path="resourceType">
						<sf:option value="">--全部--</sf:option>
						<sf:options items="${resType }" />
					</sf:select>
				</td>
				<td>资源名称:</td>
				<td>
					<sf:input path="resourceName"/>
				</td>
				<td>资源链接:</td>
				<td>
					<sf:input path="resourceUrl"/>
				</td>
				<td>权限名称:</td>
				<td>
					<sf:input path="authorityName"/>
				</td>
				<td><button><span class="icon_find">查询</span></button></td>
			</tr>
		</table>
	</div>
	</sf:form>
  	<fieldset> 
		<div class="box_tool_min padding_top2 padding_bottom2 padding_right5">
			<div class="center">
				<div class="left">
					<div class="right">
						<div class="padding_top5 padding_left10">
							<a href="sys/res/add"><span class="icon_add">新增</span></a>
							<div class="clear"></div>
						</div>
					</div>		
				</div>	
			</div>
			<div class="clear"></div>
		</div>     	
	</fieldset>
    <div id="scrollContent"  class="padding_top5" style="overflow-x:hidden;">
		<table class="tableStyle" mode="list" fixedCellHeight="true">
	    	<tr>
	    		<th>序号</th>
	    		<th>资源名称</th>
	    		<!-- <th width="200">资源描述</th> -->
	    		<th width="50">资源类型</th>
	    		<th>资源链接</th>
	    		<th width="50">链接方式</th>
	    		<th>权限名称</th>
	    		<th width="60">资源优先级</th>
	    		<th width="50">启用状态</th>
	    		<th>创建人</th>
	    		<th width="80">创建时间</th>
	    		<th>父节点</th>
	    		<th>操作</th>
	    	</tr>
	    	<c:forEach items="${pager.content}" var="i" varStatus="s">
	    	<tr>
	    		<td>${s.count}</td>
	    		<td>${i.resourceName}</td>
	    		<%-- <td>${i.resourceDesc}</td> --%>
	    		<td>${resType[i.resourceType]}</td>
	    		<td>${i.resourceUrl}</td>
	    		<td>${i.target}</td>
	    		<td>${i.authorityName}</td>
	    		<td>${i.priority}</td>
	    		<td>${resStatus[i.enabled]}</td>
	    		<td>${i.creator}</td>
	    		<td>${i.createTime}</td>
	    		<td>${i.pubResource.resourceName}</td>
	    		<td>
	    			<a href="sys/res/update/${i.resourceId}"><span class="img_edit hand" title="修改"></span></a>
	    			<a href="javascript:doDel('${i.resourceId}')"><span class="img_delete hand" title="删除"></span></a>
	    		</td>
	    	</tr>
	    	</c:forEach>
	    </table>
	</div>
    <div style="height:35px;">
		<div class="float_left padding5"></div>
		<div class="float_right padding5">
			<p:page pager="${pager }">
				<p:param name="resourceType" value="${resource.resourceType }"/>
				<p:param name="resourceName" value="${resource.resourceName }"/>
				<p:param name="resourceUrl" value="${resource.resourceUrl }"/>
				<p:param name="authorityName" value="${resource.authorityName }"/>
			</p:page>
		</div>
		<div class="clear"></div>
	</div>
	<script type="text/javascript">
		function doDel(id){
			top.Dialog.confirm("删除后将无法恢复, 请谨慎操作!",function(){
				location.href="${pageContext.request.contextPath}/sys/res/delete/"+id;
			});
		}
	</script>
  </body>
</html>
